<template>
	<view>
		<view class="state flexs justify-center align-center column">
			<image :src="stat.icon" :class="templates==1?'imageLg':'image'"> </image>
			<view class="title margin40 font28 flexs justify-center align-center row">
				<view class="cuIcon-infofill icon" v-if="templates==1"></view>
				{{stat.label}}
			</view>
			<view class="tip font28 flexs justify-center align-center row" :class="templates==1?'template1Color':''">
				
				{{stat.tip}}
			</view>
			<view :class="templates==1?'btn-bottom':'margin40'">
				<button-submit bgColor="#fa5128" @click="navClick" color="#ffffff" :text="text" :width="templates==1?'690':'260'" height="80"></button-submit>
			</view>
		</view>
	</view>
</template>

<script>
	import buttonSubmit from '@/shared/components/custom/button-submit.vue';
	import datas from "@/static/data.js"
	export default {
		props:{
			//跳至普通页面
			BackUrl: {
				type: String,
				default: ''
			}
		},
		components:{
			buttonSubmit
		},
		onLoad(opt) {
			this.templates = opt.template
			this.state = opt.state
			uni.setNavigationBarTitle({title:opt.title||"设备报修"})
			if(this.templates==1){
				this.text='去实名认证，获得健身码'
			}
		},
		computed:{
			stat(){
				let data
				if(this.state==5){
					data = this.stateData.filter(item=>item.state==this.state)[0]
				}
				return data
			}
		},
		data() {
			return {
				state:3,
				stateData:datas.data.state.list,
				defaultBackUrl:"/pages/tabbr/home",
				templates:0,
				text:'返回'
			};
		},
		methods:{
			navClick(){
				if(this.templates==1){//views/successful-identification,views/info
					uni.reLaunch({
						url:"/identification/views/info"
					})
					return
				}
				var pages = getCurrentPages();//当前页
				if (getCurrentPages().length > 1) {
					uni.navigateBack();
				} else {
					if (this.BackUrl) {
						uni.redirectTo({
							url: this.BackUrl
						})
					} else {
						if (this.defaultBackUrl) {
							uni.switchTab({
								url: this.defaultBackUrl
							})
							
						}
					}
				}
			}
		}
	}
</script>

<style lang="scss">
	.icon{
		//font-size: 48rpx;
		color: #EA5903;
		margin-right: 10rpx;
	}
	.state{
		//width: 570rpx;
		margin: 0 auto;
		padding-top: 100rpx;
		.image{
			width: 150rpx;
			height: 150rpx;
		}
		.imageLg{
			width: 458rpx;
			height: 458rpx;
		}
		.title{
			font-size: 34rpx;font-weight: bold;
			color:#333;
		}
		.tip{
			color:#333;
			
		}
		.template1Color{color:#999999;}
		.btn-bottom{position: fixed;bottom: 40rpx;}
	}
</style>
